/* 
 * Copyright (c)	Insighten Intelligent Equipment co.,LTD
 * 
 *  Use of this software is controlled by the terms and conditions found
 *  in the license agreement under which this software has been supplied.
 * 
 */
/** 
 * @file shrmem.h
 * @brief share memory utility header file
 * @author taco [tacoee@gmail.com]
 * @version 0.1
 * @date 2010-09-13
 */
#ifndef SHRMEM_H_
#define SHRMEM_H_
#include <pthread.h>

struct _ShareMem;

typedef struct _ShareMem ShareMem;

struct _ShareMem {
	pthread_mutex_t	mutex;
	int mid;
	int key;
	int mem_size;
};


ShareMem *shm_create(int key, int size);
Ret shm_destory(ShareMem *thiz);
Ret shm_destory_deeply(ShareMem *thiz);
Ret shm_read(ShareMem *thiz, int offset, void *buf, int length);
Ret shm_write(ShareMem *thiz, int offset, void *buf, int length);
#endif /*SHRMEM_H_*/
